feat(desktop): over-threshold resume guard and compaction_done live refresh - #8256
feat(desktop): over-threshold resume guard and compaction_done live refresh#8256complyue wants to merge 1 commit into
Conversation
|
Thank you. I will start the review once you are ready. |
|
Thanks for the thoughtful UI work and focused tests. I reviewed this branch against the latest #8244 has now landed and intentionally replaced the former multi-threshold maintenance path with one cache-first
This also exposes a semantic mismatch in the current four-thumb UI: in this branch, Snip is not an independent trigger at 60%. Tool-result cleanup starts only when Compact is reached (80% by default), and Snip is the target the cleanup result must fall below to avoid summary compaction. Presenting it as a separate cleanup trigger would therefore be misleading. A mechanical rebase would either leave three slider thumbs disconnected from runtime behavior or require reverting #8244's cache-first contract, which could cause earlier prompt rewrites and lower prompt-cache reuse. #8265 has also removed the ContextPanel short-view block, so that block should not be reintroduced during conflict resolution. The parts that still fit the current architecture are valuable:
Could you please re-scope this PR around the current single-threshold architecture and preserve #8265's ContextPanel deletion? If four independently configurable thresholds are still desired, that should be a separate product/architecture proposal because it changes the behavior and cache guarantees established by #8244. |
a3f5cc9 to
3b3ddfb
Compare
…itecture Keeps the review-endorsed parts of the original four-threshold PR: - over-threshold resume guard, asked BEFORE the mutating ResumeSessionPageForTab / OpenChannelSessionPageForTab calls via a read-only PreviewSession estimate, so cancelling leaves the session untouched - immediate context + balance refresh on compaction_done Drops everything tied to the multi-threshold model removed by esengine#8244 (soft/snip/force ratios, the four-thumb slider, thresholdLayout, SetCompactionThresholds, CLI snip-ratio, the widened compact-ratio range) and does not reintroduce the ContextPanel maintenance block removed by Compact threshold on current main-v2, so the gauge needs no change.
…efresh Keeps the review-endorsed parts of the original four-threshold PR esengine#8256, rescaled to the single compact_ratio architecture of esengine#8244: - over-threshold resume guard, asked BEFORE the mutating ResumeSessionPageForTab / OpenChannelSessionPageForTab calls via a read-only PreviewSession estimate, so cancelling leaves the session untouched - immediate context + balance refresh on compaction_done (the coalesced BalanceForTab query is invalidated first so the refresh reads fresh data) Drops everything tied to the multi-threshold model removed by esengine#8244 (soft/snip/force ratios, the four-thumb slider, thresholdLayout, SetCompactionThresholds, CLI snip-ratio, the widened compact-ratio range) and does not reintroduce the ContextPanel maintenance block removed by esengine#8265. The live capacity visualization already aligns with the single Compact threshold on current main-v2 (esengine#8329/esengine#8307), so the gauge is unchanged.
3b3ddfb to
417ddc0
Compare
|
@SivanCola respect your upstream decisions, if you see single compact_ratio is the best fit, there it goes. Then this PR doesn't seem do much, DSV4F has simplified the changes. |



What
Turns the single
compact_ratioknob into four explicit, independentlyconfigurable compaction thresholds (soft / snip / compact / force), exposes
real context occupancy end-to-end, and renders all four as live pins on the
desktop context gauge with a draggable settings slider.
compactThresholds()now computes soft/snip/compact/forceboundaries from the four ratios; the existing prune-then-summarize tiered
pipeline keys off the real context shape (
ContextPromptTokens) withbillable-token fallback. Config re-validation keeps the chain
soft < snip < compact < forcelegal on every change.reasonix config compact-ratio [--local] [VALUE]accepts10–95%; new
snip-ratiocommand accepts 5–95%. Project-local valuesoverride the shared user config used by desktop and new CLI sessions.
SessionHistory.CompactThresholds()andContextInfo's soft/snip/force ratios feed the desktop gauge; thesettings view exposes the slider.
occupancy ring (
ContextReport+ maintenance), context capacity pins inthe overview, and per-threshold copy in zh/zh-TW.
Docs:
docs/SPEC.mdcontext-maintenance section rewritten for the tieredthresholds (removed the "65–85%" single-threshold description).
Commit 2 is the ratchet/budget bookkeeping only (repolint baseline growth +
bundle budgets for the added code and locale copy), kept separate from the
feature diff for review.
Verification
go build ./internal/...andgo build ./...(desktop) passgo vetclean oninternal/agent,internal/control,internal/configgo test ./internal/agent/ ./internal/control/ ./internal/config/passpnpm exec tsc --noEmitcleannode scripts/check-bundle-budget.mjsall PASSgo run ./tools/repolintclean (1958 baselined findings)Cache-impact: none - compact* changes are threshold getters/computation only; the provider-visible prefix stays byte-identical
Cache-guard: no prefix-assembly path changed; run
go test ./internal/boot/(prefix stability effect tests) plus the agent/control/config suites aboveSystem-prompt-review: complyue (author) - internal/config threshold keys feed the config surface but do not alter the byte-stable system-prompt prefix
Documentation-impact: updated - docs/SPEC.md context-maintenance section rewritten for the four tiered thresholds